#include <Box2D.h>
#include "common.h"
#include "b2MouseJoint.h"

#ifdef __cplusplus
extern "C" {
#endif

JNIEXPORT jint JNICALL Java_b2MouseJoint_jni_1b2MouseJoint_1GetAnchorA
  (JNIEnv *env, jclass cls, jint addr)
{
	b2MouseJoint* joint = (b2MouseJoint*)addr;
	b2Vec2* vec = new b2Vec2();
	*vec = joint->GetAnchorA();
	return (jint)vec;
}

JNIEXPORT jint JNICALL Java_b2MouseJoint_jni_1b2MouseJoint_1GetAnchorB
  (JNIEnv *env, jclass cls, jint addr)
{
	b2MouseJoint* joint = (b2MouseJoint*)addr;
	b2Vec2* vec = new b2Vec2();
	*vec = joint->GetAnchorB();
	return (jint)vec;
}

JNIEXPORT jint JNICALL Java_b2MouseJoint_jni_1b2MouseJoint_1GetReactionForce
  (JNIEnv *env, jclass cls, jint addr, jfloat inv_dt)
{
	b2MouseJoint* joint = (b2MouseJoint*)addr;
	b2Vec2* vec = new b2Vec2();
	*vec = joint->GetReactionForce(inv_dt);
	return (jint)vec;
}

JNIEXPORT jfloat JNICALL Java_b2MouseJoint_jni_1b2MouseJoint_1GetReactionTorque
  (JNIEnv *env, jclass cls, jint addr, jfloat inv_dt)
{
	b2MouseJoint* joint = (b2MouseJoint*)addr;
	return joint->GetReactionTorque(inv_dt);
}

JNIEXPORT void JNICALL Java_b2MouseJoint_jni_1b2MouseJoint_1SetTarget
  (JNIEnv *env, jclass cls, jint addr, jint target)
{
	b2MouseJoint* joint = (b2MouseJoint*)addr;
	b2Vec2* t = (b2Vec2*)target;
	jni_b2MouseJoint_SetTarget(*t);
}

JNIEXPORT jint JNICALL Java_b2MouseJoint_jni_1b2MouseJoint_1GetTarget
  (JNIEnv *env, jclass cls, jint addr)
{
	b2MouseJoint* joint = (b2MouseJoint*)addr;
	b2Vec2* vec = &(joint->GetTarget());
	return (jint)vec;
}

JNIEXPORT void JNICALL Java_b2MouseJoint_jni_1b2MouseJoint_1SetMaxForce
  (JNIEnv *env, jclass cls, jint addr, jfloat force)
{
	b2MouseJoint* joint = (b2MouseJoint*)addr;
	joint->SetMaxForce(force);
}

JNIEXPORT jfloat JNICALL Java_b2MouseJoint_jni_1b2MouseJoint_1GetMaxForce
  (JNIEnv *env, jclass cls, jint addr)
{
	b2MouseJoint* joint = (b2MouseJoint*)addr;
	return joint->GetMaxForce();
}

JNIEXPORT void JNICALL Java_b2MouseJoint_jni_1b2MouseJoint_1SetFrequency
  (JNIEnv *env, jclass cls, jint addr, jfloat hz)
{
	b2MouseJoint* joint = (b2MouseJoint*)addr;
	joint->SetFrequency(hz);
}

JNIEXPORT jfloat JNICALL Java_b2MouseJoint_jni_1b2MouseJoint_1GetFrequency
  (JNIEnv *env, jclass cls, jint addr)
{
	b2MouseJoint* joint = (b2MouseJoint*)addr;
	return joint->GetFrequency();
}

JNIEXPORT void JNICALL Java_b2MouseJoint_jni_1b2MouseJoint_1SetDampingRatio
  (JNIEnv *env, jclass cls, jint addr, jfloat ratio)
{
	b2MouseJoint* joint = (b2MouseJoint*)addr;
	joint->SetDampingRatio(ratio);
}

JNIEXPORT jfloat JNICALL Java_b2MouseJoint_jni_1b2MouseJoint_1GetDampingRatio
  (JNIEnv *env, jclass cls, jint addr)
{
	b2MouseJoint* joint = (b2MouseJoint*)addr;
	return joint->GetDampingRatio();
}

#ifdef __cplusplus
}
#endif
